import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import*
testCase="DBshopST011_添加商品"
#打开后台网页
firefox=openBrowser(urlAdmin)
#登录后台
adminlogin(firefox)
#点击添加商品
firefox.find_elements_by_partial_link_text('添加商品')[1].click()
#点击添加商品
firefox.find_element_by_partial_link_text('添加商品').click()
#添加商品名称苹果XR
firefox.find_element_by_id('goods_name').send_keys('苹果XR')
#添加本店价格7999
firefox.find_element_by_id('goods_shop_price').send_keys('7999')
#导入select，选着虚拟商品
from selenium.webdriver.support.select import Select
s1=Select(firefox.find_element_by_id("goods_type"))
s1.select_by_visible_text('虚拟商品')
#点击保存商品
firefox.find_element_by_xpath('//button[@class="btn btn-small btn-primary" and @type="submit"]').click()
#断言
try:
    writelog('添加商品成功')
except:
    writelog('添加商品失败')

firefox.quit()




